
template<class T>
void readInAkari(T myAst[], long indLastMPC, long indLastNumbMPC, string* ids, long nIds)
{
  string line;
  ifstream myfile ("AcuA_V1.txt");
  long ind;
  AsteroidWithPole ast;

  if (myfile.is_open())
  {
    // for (int j=0; j<110; j++)  // Akari has no File Header
    //  getline (myfile,line) ; // skip header

    while ( getline (myfile,line))
      if (line.length()>1)
	{
	  // convert linefile to asteroid
	  ast.akariString2Asteroid(line);
      	  // if the asteroid is Numbered in the file assing it
	  //	  cout << line << endl;
	  if (ast.Number>0)
	    {
	      myAst[ast.Number-1].D=ast.D;
	      myAst[ast.Number-1].sigmaD=ast.sigmaD;
	      myAst[ast.Number-1].pV=ast.pV;
	      myAst[ast.Number-1].sigmapV=ast.sigmapV;
	    }
	  else
	    {
	      // can you match is right there ?
	      if ((ind = findUnnumberedAst(myAst,ast,indLastMPC,indLastNumbMPC+1))>=0) // YES ! 
		{
		  myAst[ind].D=ast.D;
		  myAst[ind].sigmaD=ast.sigmaD;
		  myAst[ind].pV=ast.pV;
		  myAst[ind].sigmapV=ast.sigmapV;
		  //		  cout << ">>match 1  " << ast.pack << endl;
		}
	      else
		{ // the designation could not be matched.
		  // try to see if the asteroid has been numbered LATER
		  ast.findId(ids,nIds);
		  if (ast.Number>0)
		    {
		      myAst[ast.Number-1].D=ast.D;
		      myAst[ast.Number-1].sigmaD=ast.sigmaD;
		      myAst[ast.Number-1].pV=ast.pV;
		      myAst[ast.Number-1].sigmapV=ast.sigmapV;
		      //		      cout << ">>match 2  " << ast.pack << endl;
		    }
		  else
		    {
		      if ((ind = findUnnumberedAst(myAst,ast,indLastMPC,indLastNumbMPC+1))>=0) // YES ! 
			{
			  myAst[ind].D=ast.D;
			  myAst[ind].sigmaD=ast.sigmaD;
			  myAst[ind].pV=ast.pV;
			  myAst[ind].sigmapV=ast.sigmapV;
			  //			  cout << ">>match 23  " << ast.pack << endl;
			}
		      else
			{
			  cout << ">>match FAILED  " << ast.pack << "--" << line << endl;
			}
		    }
		}
	    }
	}
    myfile.close();
  }
  else cout << "Unable to open file"; 
}
